//
//  MyTabBarController.m
//  Beauty
//
//  Created by Snow on 16/8/29.
//  Copyright © 2016年 Snow. All rights reserved.
//

#import "MyTabBarController.h"
#import "BaseViewController.h"
#import "MyViewController.h"
#import "FindViewController.h"
#import "FamousViewController.h"
#import "CircleViewController.h"
#import "MainViewController.h"
@interface MyTabBarController ()

@end

@implementation MyTabBarController

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.viewControllers = [self createViewControllers];
        //tabBar当前颜色
        self.tabBar.tintColor = [UIColor colorWithWhite:0.098 alpha:1.000];
//        self.tabBar.backgroundImage = [UIImage imageNamed:@"tabbar_bg"];
        //tabBar颜色
        self.tabBar.barTintColor = [UIColor whiteColor];
    }
    return self;
}
- (NSArray<BaseViewController *> *)createViewControllers
{
    NSMutableArray *arrayOfVC = [NSMutableArray array];
    //首页
    MainViewController *main = [[MainViewController alloc] init];
    UINavigationController *mainNV = [[UINavigationController alloc] initWithRootViewController:main];
    mainNV.navigationBar.barTintColor = [UIColor colorWithRed:0.000 green:0.001 blue:0.130 alpha:0.912];
    mainNV.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"首页" image:[UIImage imageNamed:@"tab_1"] tag:100];
    [arrayOfVC addObject:mainNV];
    
    //发现页
    FindViewController *find = [[FindViewController alloc]init];
    UINavigationController *findNV = [[UINavigationController alloc] initWithRootViewController:find];
    findNV.navigationBar.barTintColor = [UIColor colorWithRed:0.000 green:0.001 blue:0.130 alpha:0.912];
    findNV.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"发现" image:[UIImage imageNamed:@"tab_2"] tag:200];
    [arrayOfVC addObject:findNV];
    
    //有名堂
    FamousViewController *famous = [[FamousViewController alloc] init];
    UINavigationController *famousNV = [[UINavigationController alloc] initWithRootViewController:famous];
    famousNV.navigationBar.barTintColor = [UIColor colorWithRed:0.000 green:0.001 blue:0.130 alpha:0.912];
    famousNV.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"欢乐送" image:[UIImage imageNamed:@"tab_3"] tag:300];
    [arrayOfVC addObject:famousNV];
    
    //艺圈
    CircleViewController *circle = [[CircleViewController alloc] init];
    UINavigationController *circleNV = [[UINavigationController alloc] initWithRootViewController:circle];
    circleNV.navigationBar.barTintColor = [UIColor colorWithRed:0.000 green:0.001 blue:0.130 alpha:0.912];
    circle.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"购物袋" image:[UIImage imageNamed:@"tab_4"] tag:400];
    [arrayOfVC addObject:circleNV];
    
    //我的
    MyViewController *my = [[MyViewController alloc] init];
    UINavigationController *myNV = [[UINavigationController alloc] initWithRootViewController:my];
    myNV.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"我的" image:[UIImage imageNamed:@"tab_5"] tag:500];
    myNV.navigationBar.barTintColor =  [UIColor colorWithRed:0.110 green:0.102 blue:0.196 alpha:1.000];
    [arrayOfVC addObject:myNV];
    return arrayOfVC;
}

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
